package org.br.erp.base.sysconfig.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.br.erp.base.sysconfig.entity.Sysconfig;
import org.br.erp.base.sysconfig.mapper.SysconfigMapper;
import org.br.erp.base.sysconfig.service.ISysconfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 系统参数表
 * @Author: jeecg-boot
 * @Date:   2023-10-21
 * @Version: V1.0
 */
@Service
public class SysconfigServiceImpl extends ServiceImpl<SysconfigMapper, Sysconfig> implements ISysconfigService {

    @Autowired
    SysconfigMapper sysconfigMapper;

    @Override
    public Sysconfig getSysConfigByConfigCode(String configCode) {
        LambdaQueryWrapper<Sysconfig> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(Sysconfig::getConfigcode,configCode);
        List<Sysconfig> sysconfigs = sysconfigMapper.selectList(queryWrapper);
        if(sysconfigs.size()>0){
            return sysconfigs.get(0);
        }else {
            return null;
        }
    }
}
